/**
 * @description 存储用户游戏状态
 */

import UserService from "../service/user";
import { C, N } from "../config/commonTypes";

interface IId {
    id: number
}

const checkUserGameStatus = async (ctx:C,next:N) => {
    const  id  :number = ctx.userInfo.id;
    if(id) {
        const res = await UserService.getUserInfo<IId>({id});
        ctx.gameStatus = res;
        await next()
    }
}


export {
    checkUserGameStatus
}